<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	@section('title')
	<title>知乎</title>
	@show
	<link rel="short icon" href="/assets/images/favicon.ico" type="image/x-icon">
	<link rel="stylesheet" href="/layout/css/bootstrap.min.css">
	<link rel="stylesheet" href="/layout/css/bootstrap-theme.min.css">
	<link rel="stylesheet" href="/layout/layout.css">
	<script src="/layout/js/jquery.js"></script>
	<script src="/layout/js/bootstrap.min.js"></script>
	<script src="/layout/js/jquery.validate.min.js"></script>
	<script src="/layout/js/holder.js"></script>
	<script src="/js/plupload.full.min.js"> </script>
	@section('style')
	@show
</head>
<body>
@section('header')
<!-- 顶部固定导航栏 start -->
	<div id="navbar" class="container-fluid navbar navbar-default navbar-fixed-top" style="height: 50px;">
		<div class="container">
			<div class="col-md-1">
				<a id="logo" href="http://nfangxu.cn" class="btn">知乎</a>
			</div>
			<div class="col-md-8">
				<div id="search" class="col-md-7">
					<form action="/search">
						<div class="input-group">
							<input type="text" name="keywords" class="form-control" placeholder="搜索你感兴趣的内容...">
							<span class="input-group-btn">
								<button onclick="$('#search form').submit();" class="btn btn-default" type="button"><span class="glyphicon glyphicon-search"></span></button>
							</span>
						</div>
					</form>
				</div>
				<div id="navbar-list" class="col-md-5">
					<ul class="list-unstyled list-inline">
						<li class="col-md-3"><a href="http://nfangxu.cn">首页</a></li>
						<li class="col-md-3"><a href="http://nfangxu.cn/topic">话题</a></li>
						<li class="col-md-3"><a href="http://nfangxu.cn/explode">发现</a></li>
						@if(session('id'))
						<li class="col-md-3"><a href="http://nfangxu.cn/message">消息</a></li>
						@endif
					</ul>
				</div>
			</div>
			<div id="nav-right" class="col-md-3">
				<div id="nav-ask" class="col-md-4">
				@if(session('id'))
					<!-- bootstrap js 插件中的小模态框 -->
					<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="">提问</button>
				@endif
				</div>
				<div id="nav-user" class="col-md-6">
					<ul class="list-unstyled list-inline">
						@if(session('id'))
						<li><img width="30" src="{{session('face')}}" alt=""></li>
						<li><a href="http://nfangxu.cn/people">{{session('name')}}</a></li>
						<ul id="user-datials" class="list-unstyled ">
							<li><span class="glyphicon glyphicon-user"></span><a href="http://nfangxu.cn/people">我的主页</a></li>
							<li><span class="glyphicon glyphicon-wrench"></span><a href="http://nfangxu.cn/setting">设置</a></li>
							<li><span class="glyphicon glyphicon-envelope"></span><a href="http://nfangxu.cn/repasswd">修改密码</a></li>
							<li><span class="glyphicon glyphicon-off"></span><a href="http://nfangxu.cn/logout">退出</a></li>
						</ul>
						@else
							<li class="" style="line-height: 30px;"><a href="/login">登录</a></li>
						@endif
					</ul>
				</div>
			</div>
		</div>
	</div>
	<!-- 提问框 -->
	<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
	  <div class="modal-dialog" role="document">
	    <div class="modal-content">
		    <div id="exampleModal_title" class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" id="exampleModalLabel">提问</h4>
		    </div>
	        <form id="ask_form" action="/question" method="post">
		        <div class="modal-body">
		          	<div class="form-group">
			            <!-- <label for="recipient-name" class="control-label">问题</label> -->
			            <input type="text" name="title" class="form-control" placeholder="写下你的问题" id="recipient-name">
		          	</div>
		          	<div class="form-group">
			            <label for="message-text" class="control-label">问题描述</label>
			            <textarea name="desc" class="form-control" id="message-text"></textarea>
		          	</div>
		          	<!-- <div class="form-group">
			            <label for="recipient-name" class="control-label">话题搜索</label>
			            <input id="topic_search" type="text" name="topic_search" class="form-control" placeholder="话题越精准，越容易让相关领域专业人士看到你的问题" id="recipient-name">
		          	</div> -->
		          	<?php $columns = DB::table('columns')->get();?>
		          	<select id="column_list" class="form-control" name="column" id="">
						<option value="">所属栏目</option>
						@foreach($columns as $k=>$v)
						<option value="{{$v->id}}">{{$v->title}}</option>
						@endforeach
					</select>
		        </div>
		        <div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		        <button id="ask_btn" type="button" class="btn btn-primary">发布问题</button>
		        </div>
	        </form>
	        <script>
	        	$(function(){
	        		$('#ask_btn').click(function() {
	        			var data = {
	        				title:$('#ask_form input[name=title]').val(),
	        				content:$('#ask_form textarea[name=desc]').val(),
	        				column:$('#ask_form select[name=column]').val()
	        			};
	        			$.post('/api/question', data, function(res){
	        				if(res == '1'){
	        					$('#exampleModal_title').html('<span class="alert">问题发布成功!</span>');
	        				}else{
	        					$('#exampleModal_title').html('<span class="alert">问题发布失败!</span>');
	        				}
	        			});

	        			var t = setTimeout(function(){
	        				$('#exampleModal_title').html('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="exampleModalLabel">提问</h4>');
	        				clearTimeout(t);
	        			}, 2000);
	        		});
	        	});
	        </script>
	    </div>
	  </div>
	</div>
<!-- 顶部固定导航栏 end -->
<!-- 内容主题 -->
@show
@section('content')
@show
@section('footer')
@show
</body>
</html>